package com.wiscamp.ninechapters.problems.domain.models.problems.answers;


import com.wiscamp.ninechapters.problems.enums.AnswerTypes;
import com.wiscamp.ninechapters.problems.math.LatexDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 日期时间答案
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class DateTimeAnswer extends Answer {
    /**
     * 答案值
     */
    private LatexDateTime value;

    public DateTimeAnswer(long answerId, long questionId, int answerIndex, int groupIndex, LatexDateTime value) {
        setAnswerType(AnswerTypes.DATE_TIME);
        this.value = value;
        setAnswerId(answerId);
        setQuestionId(questionId);
        setAnswerIndex(answerIndex);
        setGroupIndex(groupIndex);
        setAnswerTypeId(this.getAnswerType().getValue());
    }

    @Override
    public String getAnswerText() {
        //this.setContentHypertext(value.getLatex());
        return value.getLatex();
    }

    /*@Override
    public boolean compareAnswer(String contentText) {
        var sheetAnswerDateTime = LocalDateTime.parse(contentText);
        var correctAnswerDateTime = value.getDateTime();
        var sheetAnswerDateTimeText = DateTimeHelper.getDateTimeString(sheetAnswerDateTime);
        var correctAnswerDateTimeText = DateTimeHelper.getDateTimeString(sheetAnswerDateTime);
        if (!sheetAnswerDateTimeText.equalsIgnoreCase(correctAnswerDateTimeText)) return false;
        return true;
    }*/
}
